var util = require('../../utils/util.js');
var api = require('../../config/api.js');
var app = getApp()
Page({
    data: {
        // text:"这是一个页面"
        topicList: [{
            id:'1',
            scene_pic_url:'/static/images/b1.png',
            title:'Super制造 Nike耐克 Kyrie瓯 文4 NCAA鸳鸯黑白全明星篮球鞋943807',
            subtitle:'4 NCAA鸳鸯黑白全明星篮球鞋943807',
            price_info:'498'
        },{
            id:'2',
            scene_pic_url:'/static/images/zt1_03.jpg',
            title:'Super制造 Nike耐克 Kyrie瓯 文4 NCAA鸳鸯黑白全明星篮球鞋943807',
            subtitle:'4 NCAA鸳鸯黑白全明星篮球鞋943807',
            price_info:'498'
        }],
        page: 1,
        size: 10,
        count: 0,
        scrollTop: 0,
        showPage: false
    },
    onLoad: function (options) {
        // 页面初始化 options为页面跳转所带来的参数
       

    },
    onReady: function () {
        // 页面渲染完成
    },
    onShow: function () {
        // 页面显示
    },
    onHide: function () {
        // 页面隐藏
    },
    onUnload: function () {
        // 页面关闭
    },
    nextPage: function (event) {
      
        
    },
    getTopic: function(){
       
        let that = this;
         that.setData({
            scrollTop: 0,
            showPage: false,
            topicList: []
        });
        // util.request(api.TopicList, { page: that.data.page, size: that.data.size }).then(function (res) {
        //   if (res.errno === 0) {

        //     that.setData({
        //       scrollTop: 0,
        //       topicList: res.data.data,
        //       showPage: true,
        //       count: res.data.count
        //     });
        //   }
        //   wx.hideToast();
        // });
        
    },
    prevPage: function (event) {
        if (this.data.page <= 1) {
            return false;
        }

        var that = this;
        that.setData({
            "page": parseInt(that.data.page) - 1
        });
        this.getTopic();
    }
})